export default{
	namespaced:true,
	/* 数据 */
	state:()=>({
		address:JSON.parse(uni.getStorageSync('address')||'{}'),
		token:'0c3Rha0w3N6qx33L5j4w3QrcX31Rha0L'/* uni.getStorageSync('token')||'' */,
		userinfo:JSON.parse(uni.getStorageSync('userinfo')||'{}')
	}),
	/* 方法 */
	mutations:{
		updateaddress(state,address){
			/* console.log(address) */
			state.address=address
			/* console.log(state.address) */
			this.commit('my_user/saveAddressTostorage')
		},
		saveTocart(state){
			uni.setStorageSync('address',JSON.stringify(state.address))
		},
		updateUserinfo(state,userinfo){
			state.userinfo=userinfo
			this.commit('my_user/saveUserinfo')
		},
		saveAddressTostorage(state){
			uni.setStorageSync('address',JSON.stringify(state.address))
		},
		saveUserinfo(state){
			uni.setStorageSync('userinfo',JSON.stringify(state.userinfo))
		},
		updateToken(state,token){
			state.token=token
			this.commit('my_user/saveToken')
		},
		saveToken(state){
			uni.setStorageSync('token',state.token)
		}
	},
	getters:{
		addstr(state){
			if(!state.address.provinceName)return ''
			return state.address.provinceName+state.address.cityName+state.address.countyName+state.address.detailInfo
		}
	}
}